逆行
题目 逆行
思路分析
代码实现
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
const int N=1000;
int E=0,W=0;
int main()
{
ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
int n;cin>>n;
while(n--){
int x;cin>>x;
if(x>0) E++;
else W++;
}
cout<<(W>E?E:W)<<endl;
return 0;
}
💬 评论